load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
    name = "go_default_library",
    srcs = ["cloudinit.go"],
    importpath = "kubevirt.io/kubevirt/cmd/example-cloudinit-hook-sidecar",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/cloud-init:go_default_library",
        "//pkg/hooks:go_default_library",
        "//pkg/hooks/info:go_default_library",
        "//pkg/hooks/v1alpha2:go_default_library",
        "//staging/src/kubevirt.io/client-go/api/v1:go_default_library",
        "//staging/src/kubevirt.io/client-go/log:go_default_library",
        "@org_golang_google_grpc//:go_default_library",
    ],
)

go_binary(
    name = "example-cloudinit-hook-sidecar",
    embed = [":go_default_library"],
    visibility = ["//visibility:public"],
)

load(
    "@io_bazel_rules_docker//container:container.bzl",
    "container_image",
)

container_image(
    name = "example-cloudinit-hook-sidecar-image",
    architecture = select({
        "@io_bazel_rules_go//go/platform:linux_ppc64le": "ppc64le",
        "//conditions:default": "amd64",
    }),
    base = select({
        "@io_bazel_rules_go//go/platform:linux_ppc64le": "@fedora_ppc64le//image",
        "//conditions:default": "@fedora//image",
    }),
    directory = "/",
    entrypoint = ["/example-cloudinit-hook-sidecar"],
    files = [":example-cloudinit-hook-sidecar"],
    visibility = ["//visibility:public"],
)
